package com.controller;

import com.pojo.Address;
import com.pojo.Result;
import com.service.AddressService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/addresses")
public class AddressController {
    @Autowired
    private AddressService addressService;
    @PostMapping("/add")
    public Result add(@RequestBody Address address) {
        log.info("添加地址");
        addressService.add(address);

        return Result.success();
    }

    @DeleteMapping("/delete/{addressId}")
    public Result deleteById(@PathVariable Integer addressId) {
        log.info("删除地址信息");
        addressService.deleteById(addressId);

        return Result.success();
    }
}
